<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>会员增加</title>
<link rel="stylesheet" type="text/css"
	href="../../res/layui/css/layui.css" media="all">
<style type="text/css">
	body{
		margin:20px 0px;

	}
</style>
</head>
<body>
	<fieldset class="layui-elem-field layui-field-title"
		style="margin-top: 20px;">
		<legend>增加会员</legend>
	</fieldset>

	<form  id="myform" class="layui-form" action="../../user/addOrUpdate.action" method="post" enctype="multipart/form-data">
		<input type="hidden" name="userId" id="userId" />
		
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">会员名称</label>
				<div class="layui-input-inline">
					<input type="text" name="userName" id="userName" required
						lay-verify="required" placeholder="会员名称" autocomplete="off" maxlength="10"
						class="layui-input">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">会员密码</label>
				<div class="layui-input-inline">
					<input type="password" name="userPassword" id="userPassword" required
						lay-verify="required" placeholder="会员密码" maxlength="10"
						autocomplete="off" class="layui-input">
				</div>
			</div>
			
		</div>
		
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">会员备注</label>
				<div class="layui-input-inline">
					<input type="text" name="remark" id="remark" required
						lay-verify="required"   placeholder="会员备注"
						autocomplete="off" class="layui-input">
				</div>
			</div>
		</div>
		
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">账号</label>
				<div class="layui-input-inline">
					<input type="text" name="userAccount" id="userAccount" required
						lay-verify="required" maxlength="10" placeholder="账号"
						autocomplete="off" class="layui-input">
				</div>
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">照片</label>
				<div class="layui-input-inline">
					<input type="file" name="userFile" id="userFile"
						     maxlength="10" placeholder="照片"
						   autocomplete="off" class="layui-input">
				</div>
				<input type="hidden" name="file" id="file">
				<img id="updateImg" src="" alt="图片" style="display: none" height="100" width="100"/>
			</div>
		</div>
		

		<div class="layui-form-item">
			<div class="layui-input-block">
				<input type="submit" class="layui-btn" lay-submit=""
					lay-filter="Add" value="提交">
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
	<script src="../../res/layui/layui.js"></script>
	<script type="text/javascript">
		
		layui.use('form', function(){
			  var form = layui.form
			  ,layer = layui.layer
			  ,$ = layui.$;
			  
			form.on('submit(Add)',function(){
				  //parent.location.reload(); // 父页面刷新
				var url = "../../user/addOrUpdate.action";
				var data = new FormData(document.getElementById("myform")) ;
				$.ajax({
					url:url,
					data:data,
					dataType:"json",
					method:"post",
					async: true,
					processData : false, // 使数据不做处理
					contentType : false, // 不要设置Content-Type请求头
					success:function (obj) {
						if(obj.state==1){
							parent.table.reload('testReload');
							parent.layer.close(parent.index);
						}
					},
					error:function (e) {
						alert(e);
					}
				});
				return false ;
			});
		});
	</script>
</body>
</html>